package cn.iocoder.yudao.module.iot.dal.mysql.scene;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.iot.dal.dataobject.scene.IotSceneLogDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 场景执行日志 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface IotSceneLogMapper extends BaseMapperX<IotSceneLogDO> {

    default List<IotSceneLogDO> selectListBySceneId(Long sceneId) {
        return selectList(new LambdaQueryWrapperX<IotSceneLogDO>()
                .eq(IotSceneLogDO::getSceneId, sceneId)
                .orderByDesc(IotSceneLogDO::getExecuteTime));
    }

    default List<IotSceneLogDO> selectListByUserId(Long userId) {
        return selectList(new LambdaQueryWrapperX<IotSceneLogDO>()
                .eq(IotSceneLogDO::getUserId, userId)
                .orderByDesc(IotSceneLogDO::getExecuteTime));
    }

} 